﻿@using Hsp.WebNovels.Web.Models
@using Hsp.WebNovels.Model.Models
@using Hsp.WebNovels.Common.Constants
@model NovelViewModel

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row-fluid">

    <div class="page-header">
        <h5 class="pull-left">
            <i class="glyphicon glyphicon-list"></i>
            <span>小说管理</span>
        </h5>
        <div class="pull-right">
            <ul class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#"><i class="fa fa-home"></i>首页</a>
                </li>
                <li class="separator">
                    <i class="fa fa-angle-right"></i>
                </li>
                <li class="breadcrumb-item active">@Model.WebName</li>
            </ul>
        </div>
    </div>

    <div id="toolbar">
        <div class="form-inline" role="form">
            <form class="form-inline form-toolbar" hidden>
                <div class="mb-3 row">
                    <input name="search" class="form-control form-control-sm" type="text" placeholder="搜索">
                    <div class="input-group input-group-sm">
                        <input id="startDate" name="startDate" class="form-control form-control-sm" type="date" style="margin-right: 0 !important;" data-toggle="tooltip" data-placement="top" title="开始日期" />
                        <div class="input-group-prepend">
                            <div class="input-group-text form-control-sm">至</div>
                        </div>
                        <input id="endDate" name="endDate" class="form-control form-control-sm" type="date" data-toggle="tooltip" data-placement="top" title="结束日期" />
                    </div>
                </div>
            </form>
            <button id="remove" class="btn btn-sm btn-danger" disabled>
                <i class="glyphicon glyphicon-remove"></i>批量删除
            </button>
            <button id="btnAdd" class="btn btn-sm btn-primary">
                <i class="glyphicon glyphicon-plus"></i>添加小说
            </button>
            <button id="btnCrawlContent" class="btn btn-primary" hidden>
                <i class="glyphicon icon-folder-plus"></i> 抓取内容
            </button>

            <div class="btn-group" role="group" aria-label="query group" hidden>
                <button id="btnSearch" class="btn btn-sm btn-primary" style="margin-right: 0!important;">
                    <i class="glyphicon glyphicon-search" aria-hidden="true"></i>查询
                </button>
                <button id="btnClear" type="reset" class="btn btn-secondary btn-sm" title="清空查询条件">
                    <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
                </button>
            </div>
        </div>
    </div>

    <div class="table-responsive">
        <table id="novel-table" class="table table-striped table-sm table-hover" data-toggle="table" data-toolbar="#toolbar"></table>
    </div>

</div>

<!-- 小说编辑模态窗体 //-->
<div class="modal fade" id="editModel" tabindex="-1" role="dialog" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="editModelLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-scrollable modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="editModelLabel">小说编辑</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">

                <form class="form-horizontal">
                    <input type="hidden" asp-for="Id" />
                    <input type="hidden" asp-for="WebId" value="@Model.WebId" />
                    <input type="hidden" asp-for="WebName" value="@Model.WebName" />
                    <div class="mb-3 row">
                        <label asp-for="Title" class="col-3 col-form-label col-form-label-sm required"></label>
                        <div class="col-9">
                            <input asp-for="Title" class="form-control form-control-sm" />
                            <span asp-validation-for="Title" class="text-danger"></span>
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label asp-for="NovelUrl" class="col-3 col-form-label col-form-label-sm required"></label>
                        <div class="col-9">
                            <input asp-for="NovelUrl" class="form-control form-control-sm" />
                            <span asp-validation-for="NovelUrl" class="text-danger"></span>
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label asp-for="Author" class="col-3 col-form-label col-form-label-sm"></label>
                        <div class="col-9">
                            <input asp-for="Author" class="form-control form-control-sm" />
                            <span asp-validation-for="Author" class="text-danger"></span>
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label asp-for="Status" class="col-3 col-form-label col-form-label-sm"></label>
                        <div class="col-9">
                            <select asp-for="Status" class="form-control form-control-sm" asp-items="Html.GetEnumSelectList<EnumStatus>()"></select>
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label asp-for="ChapterChar" class="col-3 col-form-label col-form-label-sm"></label>
                        <div class="col-9">
                            <input asp-for="ChapterChar" class="form-control form-control-sm" />
                            <span asp-validation-for="ChapterChar" class="text-danger"></span>
                        </div>
                    </div>

                    <input type="hidden" asp-for="ChapterCount" />
                    <input type="hidden" asp-for="CreateTime" />
                    <input type="hidden" asp-for="UpdateTime" />

                </form>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">
                    <i class="glyphicon glyphicon-floppy-remove" aria-hidden="true"></i>关闭
                </button>
                <button type="button" class="btn btn-sm btn-primary" id="btnSave">
                    <i class="glyphicon glyphicon-floppy-saved" aria-hidden="true"></i>保存
                </button>
            </div>
        </div>
    </div>
</div>

@section Scripts {
    @{
        await Html.RenderPartialAsync("_ValidationScriptsPartial");
    }
    <environment names="Development">
        <link href="~/view-resources/Novels/TableList.css" rel="stylesheet" asp-append-version="true" />
        <script src="~/view-resources/Novels/TableList.js" asp-append-version="true"></script>
    </environment>

    <environment names="Staging,Production">
        <link href="~/view-resources/Novels/TableList.min.css" rel="stylesheet" asp-append-version="true" />
        <script src="~/view-resources/Novels/TableList.min.js" asp-append-version="true"></script>
    </environment>

    <style type="text/css">

    </style>

    <script type="text/javascript">

    </script>

}
